package com.youbug.kefu.controller;

import com.youbug.kefu.entity.User;
import com.youbug.kefu.service.ILoginService;
import com.youbug.kefu.vo.R;
import com.youbug.kefu.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
@CrossOrigin
public class LoginController {

    @Autowired
    private ILoginService loginService;

    @PostMapping("/login")
    public R<UserInfo> getUser(@RequestBody User user){

        UserInfo login = loginService.login(user);

        return R.ok(login);
    }

    @GetMapping("/keepalive")
    public R<String> keepalive(){

        return R.ok("connect-alive");
    }

}
